package c.c.b.a.b;

import c.c.b.a.b.a.e;
import c.c.b.a.b.w.a;
import java.net.Proxy;
import java.net.ProxySelector;
import java.util.List;
import java.util.Objects;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;

/* compiled from: Address */
public final class b {
    public final w a;
    public final r b;
    public final SocketFactory c;
    public final h d;
    public final List<a0> e;
    public final List<n> f;
    public final ProxySelector g;
    public final Proxy h;
    public final SSLSocketFactory i;
    public final HostnameVerifier j;
    public final k k;

    public b(String str, int i, r rVar, SocketFactory socketFactory, SSLSocketFactory sSLSocketFactory, HostnameVerifier hostnameVerifier, k kVar, h hVar, Proxy proxy, List<a0> list, List<n> list2, ProxySelector proxySelector) {
        String str2 = str;
        int i2 = i;
        r rVar2 = rVar;
        SocketFactory socketFactory2 = socketFactory;
        SSLSocketFactory sSLSocketFactory2 = sSLSocketFactory;
        h hVar2 = hVar;
        ProxySelector proxySelector2 = proxySelector;
        a aVar = new a();
        String str3 = "https";
        String str4 = "http";
        String str5 = sSLSocketFactory2 != null ? str3 : str4;
        if (str5.equalsIgnoreCase(str4)) {
            aVar.a = str4;
        } else if (str5.equalsIgnoreCase(str3)) {
            aVar.a = str3;
        } else {
            throw new IllegalArgumentException(c.b.a.a.a.D("unexpected scheme: ", str5));
        }
        Objects.requireNonNull(str, "host == null");
        str3 = e.h(w.c(str, 0, str.length(), false));
        if (str3 != null) {
            aVar.d = str3;
            if (i2 <= 0 || i2 > 65535) {
                throw new IllegalArgumentException(c.b.a.a.a.A("unexpected port: ", i));
            }
            aVar.e = i2;
            this.a = aVar.b();
            Objects.requireNonNull(rVar2, "dns == null");
            this.b = rVar2;
            Objects.requireNonNull(socketFactory2, "socketFactory == null");
            this.c = socketFactory2;
            Objects.requireNonNull(hVar2, "proxyAuthenticator == null");
            this.d = hVar2;
            Objects.requireNonNull(list, "protocols == null");
            this.e = e.k(list);
            Objects.requireNonNull(list2, "connectionSpecs == null");
            this.f = e.k(list2);
            Objects.requireNonNull(proxySelector2, "proxySelector == null");
            this.g = proxySelector2;
            this.h = proxy;
            this.i = sSLSocketFactory2;
            this.j = hostnameVerifier;
            this.k = kVar;
            return;
        }
        throw new IllegalArgumentException(c.b.a.a.a.D("unexpected host: ", str));
    }

    public boolean a(b bVar) {
        return this.b.equals(bVar.b) && this.d.equals(bVar.d) && this.e.equals(bVar.e) && this.f.equals(bVar.f) && this.g.equals(bVar.g) && e.r(this.h, bVar.h) && e.r(this.i, bVar.i) && e.r(this.j, bVar.j) && e.r(this.k, bVar.k) && this.a.e == bVar.a.e;
    }

    public boolean equals(Object obj) {
        if (obj instanceof b) {
            b bVar = (b) obj;
            if (this.a.equals(bVar.a) && a(bVar)) {
                return true;
            }
        }
        return false;
    }

    public int hashCode() {
        int hashCode = (this.g.hashCode() + ((this.f.hashCode() + ((this.e.hashCode() + ((this.d.hashCode() + ((this.b.hashCode() + ((this.a.hashCode() + 527) * 31)) * 31)) * 31)) * 31)) * 31)) * 31;
        Proxy proxy = this.h;
        int i = 0;
        hashCode = (hashCode + (proxy != null ? proxy.hashCode() : 0)) * 31;
        SSLSocketFactory sSLSocketFactory = this.i;
        hashCode = (hashCode + (sSLSocketFactory != null ? sSLSocketFactory.hashCode() : 0)) * 31;
        HostnameVerifier hostnameVerifier = this.j;
        hashCode = (hashCode + (hostnameVerifier != null ? hostnameVerifier.hashCode() : 0)) * 31;
        k kVar = this.k;
        if (kVar != null) {
            i = kVar.hashCode();
        }
        return hashCode + i;
    }

    public String toString() {
        StringBuilder g = c.b.a.a.a.g("Address{");
        g.append(this.a.d);
        g.append(":");
        g.append(this.a.e);
        if (this.h != null) {
            g.append(", proxy=");
            g.append(this.h);
        } else {
            g.append(", proxySelector=");
            g.append(this.g);
        }
        g.append("}");
        return g.toString();
    }
}
